﻿using ProjScan.RecordManager;
using ProjScan.RecordManager.AssetData;
using ProjScan.ScanRule.Attr;
using UnityEngine;

namespace ProjScan.ScanRule.ProjectAssets.Texture2D
{
    [TextureRuleAttr]
    internal class Texture_AnisoFilter : RecordRuleImp<TextureAssetData, TextureRecordManager>
    {
        protected override bool IsOK(TextureAssetData assetData)
        {
            if (QualitySettings.anisotropicFiltering == AnisotropicFiltering.Disable)
            {
                return true;
            }

            if (!assetData.mipmapEnabled)
            {
                return true;
            }

            if (QualitySettings.anisotropicFiltering == AnisotropicFiltering.ForceEnable)
            {
                return assetData.anisoLevel <= 0;
            }

            return assetData.anisoLevel <= 1;
        }
    }
}